package main

import "fmt"

const PI = 3.14159

const Ln2 = 0.693147180559945309417232121458176568075500134360255254120680009

const Log2E = 1 / Ln2 // this is a precise reciprocal

const Billion = 1e9 // float constant

const hardEight = (1 << 100) >> 97

const beef, two, c1 = "eat", 2, "veg"

const (
	Monday, Tuesday, Wednesday = 1, 2, 3
	Thursday, Friday, Saturday = 4, 5, 6
)

const (
	Unknown = 0
	Female  = 1
	Male    = 2
)

const (
	a = iota
	b = iota
	c = iota
)

// 赋值一个常量时，之后没赋值的常量都会应用上一行的赋值表达式
const (
	d = iota // a = 0
	e        // b = 1
	f        // c = 2
	g = 5    // d = 5
	h        // e = 5
)

const (
	Open = 1 << iota
	Close
	Pending
)

const (
	_  = iota             // 使用 _ 忽略不需要的 iota
	KB = 1 << (10 * iota) // 1 << (10*1)
	MB                    // 1 << (10*2)
	GB                    // 1 << (10*3)
	TB                    // 1 << (10*4)
	PB                    // 1 << (10*5)
	EB                    // 1 << (10*6)
)

func main() {
	fmt.Printf("a = %d  b = %d  c = %d \n", a, b, c)
	fmt.Printf("d = %d  e = %d  f = %d  g = %d  h = %d \n", d, e, f, g, h)
	fmt.Printf("Open = %v  Close = %v  Pending = %v \n", Open, Close, Pending)
	fmt.Printf("KB = %d  MB = %d  GB = %d  TB = %d PB = %d  EB = %d \n", KB, MB, GB, TB, PB, EB)
}
